{% extends 'base.html' %}

{% block title %}首页{% endblock %}

{% block content %}

<!-- 搜索框 -->
<div class="card mt-3">
    <div class="card-header">搜索</div>
    <div class="card-body">
        <form method="GET" action="{{ url_for('app.search_tables') }}" class="row g-3">
            <div class="col-md-10">
                <input type="text" class="form-control" id="searchTableName" name="table_name" placeholder="输入表名">
            </div>

            <div class="col-md-2 d-flex align-items-end">
                <button type="submit" class="btn btn-primary w-100">搜索</button>
            </div>
        </form>
    </div>
</div>

<!-- 文件列表 -->
<div class="card mt-3">
    <div class="card-header">文件列表</div>
    <div class="card-body">
        <table class="table table-bordered mt-3">
            <thead>
            <tr>
                <th>文件名称</th>
                <th>表数量</th>
                <th>数据库类型</th>
                <th>MD5</th>
                <th>修改时间</th>
                <th>文件大小</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            {% for pdm in pdms %}
            <tr>
                <td>{{ pdm.file_name }}</td>
                <td>{{ pdm.table_count }}</td>
                <td>{{ pdm.database_type }}</td>
                <td>{{ pdm.file_md5 }}</td>
                <td>{{ pdm.file_modify_time }}</td>
                <td>{{ pdm.file_size }}</td>
                <td>
                    <a class="btn btn-primary btn-sm" href="/package/{{pdm.fid}}/">查看</a>
                </td>
            </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>
</div>
{% endblock %}